export default defineEventHandler(async (event) => {
  const query = getQuery(event);
  const resourceId = query.resourceId;

  // 模拟从数据库查询属性数据
  const mockPropertyData = [
    {
      id: 'data_1',
      resourceId: '1',
      schemaId: '1',
      data: {
        roomNumber: '101',
        floor: 1,
        status: 'available',
      },
      createTime: 1703123456789,
      updateTime: 1703123456789,
    },
    {
      id: 'data_2',
      resourceId: '2',
      schemaId: '2',
      data: {
        roomNumber: '201',
        floor: 2,
        status: 'booked',
      },
      createTime: 1703123456789,
      updateTime: 1703123456789,
    },
    {
      id: 'data_3',
      resourceId: '3',
      schemaId: '3',
      data: {
        roomNumber: '301',
        floor: 3,
        status: 'occupied',
      },
      createTime: 1703123456789,
      updateTime: 1703123456789,
    },
  ];

  // 根据resourceId查找对应的属性数据
  const propertyData = mockPropertyData.find(
    (d) => d.resourceId === resourceId,
  );

  return {
    code: 200,
    data: propertyData || null,
    message: propertyData ? '查询成功' : '未找到对应的属性数据',
  };
});
